package cn.com.chengmandian.bike.service.impl;

import cn.com.chengmandian.bike.mapper.EbPayAccountMapper;
import cn.com.chengmandian.bike.model.EbPayAccount;
import cn.com.chengmandian.bike.service.IEbAgentInfoService;
import cn.com.chengmandian.bike.service.IEbPayAccountService;
import cn.com.chengmandian.core.common.constants.CommonConstant;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 电单车运营-支付模块-收款账户 服务实现类
 * </p>
 *
 * @author AutoGenerator
 * @since 2024-07-18
 */
@Slf4j
@Service
public class EbPayAccountServiceImpl extends ServiceImpl<EbPayAccountMapper, EbPayAccount> implements IEbPayAccountService {
    @Autowired
    private IEbAgentInfoService agentInfoService;

    public EbPayAccount getPayAccount(Integer payAccountId, Integer memberId) {
        try {
            if (payAccountId == null) return null;
            EbPayAccount payAccount = this.getById(payAccountId);
            if (CommonConstant.ZERO.equals(payAccount.getIsTest())) return payAccount;
            if (!memberId.equals(payAccount.getTestMemberId())) return null;
            return payAccount;
        } catch (Exception e) {
            log.error("getPayAccount error!", e);
        }
        return null;
    }
}
